package com.atguigu.guli.service.edu.controller;

import com.atguigu.guli.service.base.result.R;
import org.springframework.web.bind.annotation.*;

/**
 * @author helen
 * @since 2020/6/22
 */
//@CrossOrigin
@RestController
@RequestMapping("/user")
public class LoginController {

    /**
     * 用户登录获取token
     * @return
     */
    @PostMapping("login")
    public R login(){
        return R.ok().data("token", "admin");
    }

    /**
     * 登陆成功后携带token获取用户基本信息
     * @return
     */
    @GetMapping("info")
    public R info(){
        return R.ok()
                .data("name", "Helen")
                .data("roles", "[teacher]")
                .data("avatar", "https://oss.aliyuncs.com/aliyun_id_photo_bucket/default_handsome.jpg");
    }

    /**
     * 用户登出
     * @return
     */
    @PostMapping("logout")
    public R logout(){
        return R.ok();
    }
}
